import java.sql.Array;
import java.util.Arrays;

//public class pr     {
//    public static void main(String[] args) {
////        int[]arr={1,2,3,4,5};
////        fun1(arr);
////        System.out.println(Arrays.toString(arr));
////        fun2(arr);
////        System.out.println(Arrays.toString((arr)));
//        int x=10;
//        int m=fun(x);
//        System.out.println(m);
//
//    }
//    public static int fun(int a)
//    {
//        a=20;
//        return a;
//    }
//    public static void fun1(int[]arr){
//        arr=new int[]{11,22,33,44,55};
//    }
//    public static void fun2(int[]arr){
//        arr[0]=99;
//    }
//
//
//
//
//
//
//
//
//
//
//
//    public static void main1(String[] args) {
//        int []arr={1,66,3,4,5};
//        int []arr2=new int[] {1,2,3,4,5};
//        for(int i=0;i<arr.length;i++)
//        {
//            System.out.print(arr[i]);
//        }
//        System.out.println();
//        for(int x:arr){
//            System.out.print(x+" ");
//        }
//        System.out.println();
//        String str= Arrays.toString(arr);
//        System.out.println(str);
//
//    }
//}
public class pr     {
        public static int emoveDuplicates(int[]nums) {
            int j=1;
            for (int i = 1; i < nums.length; i++) {
                if(nums[i]!=nums[i-1]){
                    nums[j]=nums[i];
                    j++;
                }
            }
            return j;
        }

        public static void main(String[] args) {
            int[]arr={0,0,1,1,1,2,2,3,3,4};
            int n= emoveDuplicates(arr);
            System.out.println(n);
        }

    public static void main15(String[] args) {
        int[]arr={1,2,34,3,4,5,7,23,12};
        boolean fal=false;
        for (int i = 0; i < arr.length-1; i++) {
       if(arr[i]%2!=0&&arr[i+1]%2!=0&&arr[i+2]%2!=0){
     fal=true;
           break;
       }
        }
        if(fal){
            System.out.println(true);
        }
        else{
            System.out.println(fal);
        }
    }











    public static void main14(String[] args) {
        int[]arr={2,2,1,1,1,2,2};
        for (int i = 0; i < arr.length; i++) {
            int count=0;
            int num=arr[i];
            for (int j = i; j < arr.length; j++) {
             if(arr[j]==num){
                 count++;
               }
            }
            if(count> arr.length/2){
                System.out.println(num);
            }
        }
    }











    public static void main13(String[] args) {
        int[]arr={1,2,4,1,2};
        //假设第一个为目标数
        int num=arr[0];

        for (int j = 0; j < arr.length-1; j++) {
             num=arr[j];
            int count=0;
        for (int i = 0; i <arr.length; i++) {
            if(arr[i]==num){
                count++;
            }
        }
            if(count==1){
                System.out.println(num);
            }
        }
    }












    public static void main12(String[] args) {
        int []nums={2,7,11,15};
        int target=9;
        for (int i = 0; i < nums.length; i++) {
            for (int j = 1; j < nums.length; j++) {
                if(nums[i]+nums[j]==target){
                    System.out.println("["+i+","+j+"]");
                    break;
                }
            }
        }
    }













    public static void main11(String[] args) {
        int[]arr={1,2,3,4,5,6};
        int count=1;
        for(int i=0;i< arr.length-1;i++){
            int flex=1;
        if(arr[i]%2==0){
            while((arr[arr.length-count])%2==0){
                //判断是否已经结束
                if(count== arr.length-i){
                    flex=0;
                    break;
                }
                count++;
            }
            if(flex==0){
                break;
            }
            int tem=arr[i];
            arr[i]=arr[arr.length-count];
                  arr[arr.length-count]=tem;
                  count++;
        }
        }
        System.out.println(Arrays.toString(arr));
    }













    public static void main10(String[] args) {
        int[] arr = {1,2,3,4};
       int num= sum(arr);
        System.out.println(num);
    }
    public static int sum(int []arr){
        int num=0;
        for (int i = 0; i < arr.length; i++) {
            num+=arr[i];
        }
        return num;
    }
    public static void main9(String[] args) {
        int[]brr={1,56,32,4,8,74,12};
        blu(brr);
        System.out.println(Arrays.toString(brr));
    }
    public static void blu(int[]arr){
        for (int i = 0; i < arr.length-1; i++) {
            int n=0;
            for (int j = 0; j <arr.length-1-i ; j++) {
                if(arr[j]>arr[j+1]){
                    int tem=arr[j+1];
                    arr[j+1]=arr[j];
                    arr[j]=tem;
                    n=1;
                }
            }
            if(n==0){
                break;
            }
        }
    }









    public static void main8(String[] args) {
//        int arr[]={66,2,3,14,56,6,7,38,9,99};
//        System.out.println(Arrays.binarySearch(arr,56));
//        int brr[]={66,2,3,14,56,6,7,38,9,99};
//        System.out.println(Arrays.equals(arr, brr));
        int []arr=new int[10];
        Arrays.fill(arr,1,3,99);
        System.out.println(Arrays.toString(arr));

    }
    public static int erfen(int[]arr,int key){
        int i=0,j=arr.length-1;
        while(i<=j){
            int m=(i+j)/2;
        if(arr[m]<key){
         i=m+1;
        }
        else if(arr[m]==key){
          return key;
        }
        else{
            j=m-1;
        }
    }
        return -1;
    }
    public static void main7(String[] args) {
        int arr[]={1,2,3,4,5,6,7,8,9};
        int[]brr=arr.clone();
        System.out.println(Arrays.toString(brr));

    }
    public static void main6(String[] args) {
        int arr[]={1,2,3,4,5,6,7,8,9};
int brr[]=new int[arr.length];
System.arraycopy(arr,0,brr,1,arr.length-1);
        System.out.println(Arrays.toString(brr));

    }
    public static void main5(String[] args) {
        int arr[]={1,2,3,4,5,6,7,8,9};
        arr=Arrays.copyOfRange(arr,1,6);
        System.out.println(Arrays.toString(arr));
    }
    public static void main4(String[] args) {
        int arr[]={1,2,3,4};
        arr=Arrays.copyOf(arr,arr.length*3);
        System.out.println(Arrays.toString(arr));
    }
    public static void main3(String[] args) {
        int arr[]={1,2,3,4};
        int brr[]=Arrays.copyOf(arr,arr.length*3);
        System.out.println(brr[0]);
        System.out.println(Arrays.toString(brr));
    }
    public static void main2(String[] args) {
        int x = 10;
        assert x > 5 : "x不大于5"; // 断言x > 5
        x = 3;
        assert x > 5 : "x不大于5"; // 断言失败，抛出AssertionError："x不大于5"
    }
    public static void main1(String[] args) {
//        int []arr={1,2,3,4,5};
        int []arr=null;
       String ter= mytoString(arr);
        System.out.println(ter);
        int []brr={1,2,3,4,5};
        String mer=Arrays.toString(brr);
        System.out.println(mer);
        String men="}[]cxa]";
        int[] num={1,2,3,4,5};
        for (int i = 0; i < num.length; i++) {
            men+=num[i];
        }
        System.out.println(men);

    }
    public static String mytoString(int[]arr){
        if(arr==null){
            return "null";
        }
        String ter="[";
        for (int i = 0; i < arr.length; i++) {
            ter+=arr[i];
//            if(i==arr.length-1)
//            {
//                break;
//            }
//            ter+=",";
            if(i!=arr.length-1)
            {
                ter+=", ";
            }
        }
        ter+="]";

        return ter;
    }
    }